<template>
    <div>
  <comcart>
     <div slot="body_name">
         <el-table
    :data="tableData"
    height="250"
    border
    style="width: 100%">
    <el-table-column
      prop="id"
      label="序号"
      width="80">
    </el-table-column>
    <el-table-column
      prop="authName"
      label="权限名称"
      width="350">
    </el-table-column>
    <el-table-column
      prop="path"
      label="路径">
    </el-table-column>
     <el-table-column label="权限级别">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level==0" >一级</el-tag>
            <el-tag v-if="scope.row.level==1" type="success">二级</el-tag>
            <el-tag v-if="scope.row.level==2" type="warning">三级</el-tag>
          </template>
        </el-table-column>
  </el-table>
     </div>


     
 </comcart>
    </div>
</template>

<script>
 import comcart from "../../components/comcart"
    export default {
        components:{
            comcart
        },
        data(){
            return{
                tableData:[],
                searchObj:{
                    type:"",
                    id:"",
                    authName: "",
                    level: "",
                    pid: "",
                    path: "",
                }
            }
        },
        methods:{
          //数据渲染
          async  query(){
                let rst=await this.$http.get("/rights/list",this.searchObj)
                // console.log(rst);
                   let {id,authName,level,path,pid}=rst
                this.tableData=rst.data
                this.searchObj.id=id
                this.searchObj.authName=authName
                this.searchObj.path=path
                this.searchObj.level=level
                this.searchObj.pid=pid
            }
        },
        mounted(){
            this.query()
        }
    }
</script>

<style lang="less" scoped>

</style>